package com.lwz.builder;

public class Student {

	private int id;
	private String name;
	private String passwd;
	private String sex;
	private String address;

	// 构造器尽量缩小范围
	private Student() {
	}

	// 构造器尽量缩小范围
	private Student(Student origin) {
		// 拷贝一份
		this.id = origin.id;
		this.name = origin.name;
		this.passwd = origin.passwd;
		this.sex = origin.sex;
		this.address = origin.address;
	}
	
	
	
	@Override
	public String toString() {
		return "Student [id=" + id + ", name=" + name + ", passwd=" + passwd + ", sex=" + sex + ", address=" + address
				+ "]";
	}



	public static class StudentBuilder{

		private Student target;
		
		public StudentBuilder() {
	                   target = new Student();
	            }
		
		public StudentBuilder setId(int id){
			target.id = id;
			return this;
		}
		
		public StudentBuilder setName(String name){
			target.name = name;
			return this;
		}
		
		public StudentBuilder setPasswd(String passwd){
			target.passwd = passwd;
			return this;
		}
		
		public StudentBuilder setSex(String sex){
			target.sex = sex;
			return this;
		}
		
		public StudentBuilder setAddress(String address){
			target.address = address;
			return this;
		}
		
		public Student build() {
            return new Student(target);
                       }
		
	}


}
